﻿@using KPIS.GERP.Models.SYS.Resources
@model KPIS.GERP.Models.FIM.ChequeBook

@{
    ViewBag.Title = "ทะเบียนเช็ค";
}

@using (Html.BeginForm("Create", "ChequeBook", FormMethod.Post, new { @class = "form-horizontal" }))
{
    @Html.AntiForgeryToken()

    <div class="block-button-menu-above">
        @Html.ButtonViewAll()
        @Html.ButtonSubmit()
    </div>
    
    <div class="alert-error">@Html.ValidationSummary()</div>
    @Html.Partial("_EditorForm")

}

@section scripts
{
    <script>
        $("form").submit(function (e) {
            e.preventDefault();
            var currentForm = this;
            bootbox.confirm(function (result) {
                if (result) {
                    currentForm.submit();
                }
            });
        });

        $(document).keyup(function () {
            var StartCheque = parseInt($('#StartChequeNo').val());
            var EndCheque = parseInt($('#EndChequeNo').val());
            var OverCheque = StartCheque + 100;

            if (EndCheque > OverCheque) {
                alert("กรุณาตรวจสอบเลขที่เช็คอีกครั้ง");
                $('#EndChequeNo').val('');
            }
        });
        
    </script>
}